#ifndef QTVISIOSERVER_H
#define QTVISIOSERVER_H

#include <QWidget>
#include <QtNetwork>
#include <QStringList>

namespace Ui {
class QtVisioServer;
}

class QtVisioServer : public QWidget
{
    Q_OBJECT
    
public:
    explicit QtVisioServer(QWidget *parent = 0);
    ~QtVisioServer();
    void sendToAll(const QString &message);

private slots:
    void serveurConnecDisconnect();
    void clientConnect();
    void clientDisconnect();
    void newData();

private:
    int _port;
    Ui::QtVisioServer *ui;
    bool _serverStatus;
    QTcpServer * _server;
    QList<QPair<QTcpSocket *, QString> >  _clients;
    QStringListModel * _model;
    qint16 _dataSize;

    void updateClientsList();
    void sendClientsList();

};

#endif // QTVISIOSERVER_H
